package com.fy56.platform.logistics.service.impl;

import com.fy56.platform.logistics.common.ResultModel;
import com.fy56.platform.logistics.mapper.AdministrativeDivisionMapper;
import com.fy56.platform.logistics.model.TbAdministrativeDivision;
import com.fy56.platform.logistics.service.wx.IAdministrativeDivisionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

/**
 * 应用系统Service
 * Created by ShanFei on 2017-03-17.
 */
@SuppressWarnings("ALL")
@Service
@Transactional(readOnly = true)
public class AdministrativeDivisionServiceImpl implements IAdministrativeDivisionService {
    @Autowired
    private AdministrativeDivisionMapper administrativeDivisionMapper;

    @Override
    public TbAdministrativeDivision selectByPrimaryKey(Long id) {
        return administrativeDivisionMapper.selectByPrimaryKey(id);
    }

    @Override
    public TbAdministrativeDivision get(TbAdministrativeDivision entity) {
        return null;
    }

    @Override
    public ResultModel insert(TbAdministrativeDivision entity) {
        return null;
    }

    @Override
    public ResultModel insertSelective(TbAdministrativeDivision entity) {
        return null;
    }

    @Override
    public ResultModel update(TbAdministrativeDivision entity) {
        return null;
    }

    @Override
    public ResultModel updateSelective(TbAdministrativeDivision entity) {
        return null;
    }

    @Override
    public ResultModel delete(Long id) {
        return null;
    }

    @Override
    public ResultModel delete(TbAdministrativeDivision entity) {
        return null;
    }

    @Override
    @Transactional(readOnly = true)
    public List<TbAdministrativeDivision> findList(TbAdministrativeDivision entity) {
        List<TbAdministrativeDivision> list = administrativeDivisionMapper.findList(entity);
        return list;
    }

    @Override
    public List<TbAdministrativeDivision> selectByParams(HashMap<String, Object> params){
        return administrativeDivisionMapper.selectByParams(params);
    }

    @Override
    public int updateByPrimaryKeySelective(TbAdministrativeDivision tbAdministrativeDivision) {
        if(null != tbAdministrativeDivision && null != tbAdministrativeDivision.getAdministrativeDivisionId()){
            return administrativeDivisionMapper.updateByPrimaryKeySelective(tbAdministrativeDivision);
        }
        return 0;
    }

    @Override
    public int insertTbAdministrativeDivisionSelective(TbAdministrativeDivision tbAdministrativeDivision) {
        if(null != tbAdministrativeDivision && null != tbAdministrativeDivision.getAdministrativeDivisionName()
                && null != tbAdministrativeDivision.getCreateTime() && null != tbAdministrativeDivision.getCreateBy()){
            return administrativeDivisionMapper.insertTbAdministrativeDivisionSelective(tbAdministrativeDivision);
        }
        return 0;
    }
}
